{% load crispy_forms_tags %}

<div id="{{ prefix }}-form-{{ index }}" data-form>
    {# TODO when user delete the first form, then this divider may appear not suitable #}
    {% if index %}
        <div class="tw:divider"></div>
    {% endif %}
    
    <div class="tw:flex tw:gap-2">
        <div class="tw:flex-auto">
            {{ form|crispy }}
        </div>
        
        {% if in_create or in_edit %}
            <div class="tw:flex-initial">
                <div class="tw:size-full tw:flex tw:flex-col tw:justify-center">
                    <button type="button"
                        data-delete-form
                        class="tw:btn">
                        {% trans '删除' %}
                    </button>
                </div>
            </div>
        {% endif %}
    </div>
</div>
